package com.weactivity.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.weactivity.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper extends BaseMapper<User> {

    @Insert("insert into user (phone , password, create_time) values (#{phone},#{password},#{createTime})")
    int insertUser(User user);


    @Select("select * from user where nick_name = #{userName}")
    User findByUserName(String userName);

    @Select("select * from user where nick_name = #{keyword} or id=#{keyword};")
    User findByKeyword(String keyword);

    @Select("select role from user_activity_role  where aid = #{aid} and uid = #{uid};")
    int findRoleByAidAndUid(@Param("aid") int aid ,@Param("uid") int uid );

    @Select("select nick_name from user where id = #{uid};")
    String findNameById(int uid);
}
